/**
 * 定义本地测试接口，最好与正式接口一致，尽可能减少联调阶段修改的工作量
 */
// 引入mockjs
import Mock from "mockjs";
// 引入模板函数类

// 图片模块
import Image from "./modules/image";

// 管理员模块
import Admin from "./modules/admin";

// 员工模块
import Employee from "./modules/employee";

// 微信登录模块
import Landing from "./modules/landing";

// 图片模块
import ScenicSpot from "./modules/scenicSpot";

// touristRoute 模块
import TouristRouter from "./modules/touristRouter";

// city 模块
import City from "./modules/city";

// hotel 模块
import Hotel from "./modules/hotel";

// 文化演艺模块
import ArtShow from "./modules/artShow";

const { mock } = Mock; // Mock函数

// 使用拦截规则拦截命中的请求
// mock( url, post/get, 返回的数据/函数（有return值）);

// 图片模块
mock(RegExp("/mock/api/v1/image/uploadImg" + ".*"), "post", Image.uploadImage);
mock(RegExp("/mock/api/v1/image/showImg" + ".*"), "post", Image.showImage);

// 管理员模块
mock(
  RegExp("/mock/api/v1/admin/register" + ".*"),
  "post",
  Admin.registerEmployee
);

// 员工模块
mock(
  RegExp("/mock/api/v1/employee/page" + ".*"),
  "get",
  Employee.pageSearchEmployee
);
mock(
  RegExp("/mock/api/v1/employee/queryOneEmployee" + ".*"),
  "get",
  Employee.searchSingleEmployee
);
mock(
  RegExp("/mock/api/v1/employee/update" + ".*"),
  "post",
  Employee.updateEmployee
);
mock(
  RegExp("/mock/api/v1/employee/delete" + ".*"),
  "delete",
  Employee.deleteEmployee
);

// 登录模块
mock(
  RegExp("/mock/api/v1/landing/employee" + ".*"),
  "post",
  Landing.weixinLoginIn
);
mock(
  RegExp("/mock/api/v1/landing/customer" + ".*"),
  "post",
  Landing.customerLoginIn
);

// 景点模块
mock(
  RegExp("/mock/api/v1/scenicSpot/create" + ".*"),
  "post",
  ScenicSpot.createScenicSpot
);
mock(
  RegExp("/mock/api/v1/scenicSpot/update" + ".*"),
  "post",
  ScenicSpot.updateScenicSpot
);
mock(
  RegExp("/mock/api/v1/scenicSpot/delete" + ".*"),
  "delete",
  ScenicSpot.deleteScenicSpot
);
mock(
  RegExp("/mock/api/v1/scenicSpot/queryByPage" + ".*"),
  "get",
  ScenicSpot.searchAllScenicSpot
);

mock(
  RegExp("/mock/api/v1/scenicSpot/query" + ".*"),
  "get",
  ScenicSpot.searchSingleScenicSpot
);

mock(
  RegExp("/mock/api/v1/scenicSpot/uploadImg" + ".*"),
  "post",
  ScenicSpot.uploadImage
);
mock(
  RegExp("/mock/api/v1/scenicSpot/showImg" + ".*"),
  "get",
  ScenicSpot.showImage
);

// touristRoute 模块
mock(
  RegExp("/mock/api/v1/touristRoute/add" + ".*"),
  "post",
  TouristRouter.addTouristRoute
);
mock(
  RegExp("/mock/api/v1/touristRoute/get" + ".*"),
  "get",
  TouristRouter.getTouristRoute
);
mock(
  RegExp("/mock/api/v1/touristRoute/update" + ".*"),
  "post",
  TouristRouter.updateTouristRoute
);
mock(
  RegExp("/mock/api/v1/touristRoute/queryPersonalByPage" + ".*"),
  "get",
  TouristRouter.getAllTourist
);
mock(
  RegExp("/mock/api/v1/touristRoute/delete" + ".*"),
  "delete",
  TouristRouter.deleteTouristRoute
);

// city 模块
mock(
  RegExp("/mock/api/v2/city/getScenicSpots" + ".*"),
  "get",
  City.getBelongCity
);
mock(RegExp("/mock/api/v2/city/get" + ".*"), "get", City.getCity);

// hotel 模块
mock(
  RegExp("/mock/api/v2/hotel/getByPage" + ".*"),
  "get",
  Hotel.getHotelByPage
);
mock(RegExp("/mock/api/v2/hotel/add" + ".*"), "post", Hotel.addHotel);
mock(RegExp("/mock/api/v2/hotel/update" + ".*"), "post", Hotel.updateHotel);
mock(RegExp("/mock/api/v2/hotel/delete" + ".*"), "post", Hotel.deleteHotel);


// 文化演艺模块
mock(RegExp("/mock/api/v1/artShow/add"), "post", ArtShow.addArtShow);
mock(RegExp("/mock/api/v1/artShow/get" + ".*"), "get", ArtShow.getArtShowByPage);
